In wireless network, a passive optical network, a power line communication network, and even a wired network, researchers commonly adopt a key to protect security of the communication data, such that confidentiality of the communication data is ensured by protection, and integrality of data is ensured by calculating an integrity check value, so as to prevent communication data in communication network from being eavesdropped or altered by illegals. It is necessary for a sender and a receiver of the data to know the key in those mechanisms for protecting the security of the data.
In order to prevent the key from being obtained by an illegal user by analyzing the intercepted data and thereby prevent the communication data from being obtained or altered by the illegal user, the key needs to be updated frequently. There are many ways to update the key. However, many key update mechanisms merely solve the problem how the two communicating parties obtain a new key, but do not concern the problem on how to switch between the original key and the new key by the sender and the receiver. Generally, since the two communicating parties switch to the new key at different time instants, a communication packet sent by the sender cannot be de-protected by the receiver if the switching is performed inappropriately.